package org.github.core.util.tree;

import java.util.List;
import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import lombok.Data;
import static com.google.common.collect.Lists.newArrayList;

@Data
public class TreeNode<I, E> {
    @Nullable
    private I pid;
    @NotNull
    private I id;
    @NotNull
    private String name;
    @NotNull
    private E extra;
    @NotNull
    private List<? extends TreeNode<I, E>> child = newArrayList();

    public TreeNode(@Nullable I pid, @NotNull I id, @NotNull String name) {
        this.pid = pid;
        this.id = id;
        this.name = name;
    }

    public TreeNode() {
    }
}
